package week3;

/**
 * Created by mc on 2017/3/12.
 */
class migong{
    int[][] maze;
    int b;
    int c;
    void move(){
        if(maze[b+1][c]==0)
         b=b+1;
        else if(maze[b][c+1]==0)
         c=c+1;
        else if(maze[b-1][c]==0)
         b=b-1;
        else if(maze[b][c-1]==0)
         c=c-1;
        System.out.printf("当前位置是(%d,%d)\n",b,c);

    }
//    bool isSucceed()
}
public class test52 {
    public static void main(String[] arge) {
        int b,c,f;
        f=0;
        int d[]=new int [10000];
        int e[]=new int [10000];
        migong a = new migong();


        a.maze= new int[][]{
                {2, 2, 2, 2, 2, 2, 2},
                {0, 0, 0, 0, 0, 0, 2},
                {2, 0, 2, 0, 2, 0, 2},
                {2, 0, 0, 2, 0, 2, 2},
                {2, 2, 0, 2, 0, 2, 2},
                {2, 0, 0, 0, 0, 0, 2},
                {2, 2, 2, 2, 2, 0, 2}

        };
        while(f==0)
        {
            a.move();
            if(a.b==6 && a.c==5)
                f=1;
        }

    }
}
